package com.structure.flyWeight;

/**享元模式
 * @author lsh
 *
 */
public class Main {

	public static void main(String[] args) {
		FlyWeightFactory factory = new FlyWeightFactory("1");
		FlyWeight flyWeight = factory.getFlyWeight("1");
		FlyWeight flyWeight2 = factory.getFlyWeight("1");
		System.out.println(flyWeight==flyWeight2);
		flyWeight.action(3);
		System.out.println(factory.getSize());
	}
}
